import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        System.out.println(longestPalindrome(str));
    }

    public static String longestPalindrome(String s) {
        int n = s.length(),begin=0,len=0;
        for (int i = 0; i <n ; i++) {
            //先找奇数
            int left=i,right=i;
            while (left>=0&&right<n&&s.charAt(left)==s.charAt(right)){
                left--;
                right++;
            }
            if(right-left-1>len){
                begin=left+1;
                len=right-left-1;
            }

            //偶数
            left=i;
            right=i+1;
            while (left>=0&&right<n&&s.charAt(left)==s.charAt(right)){
                left--;
                right++;
            }
            if(right-left-1>len){
                begin=left+1;
                len=right-left-1;
            }
        }
        return s.substring(begin,begin+len);
    }
}
